<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
			<form action="http://www.test8899.com/reg.php" method="post">
				<table border="1" cellspacing="0" cellpadding="10" id="tableid">
				    <tr>
				        <th></th>
				        <th>姓名</th>
				        <th>性别</th>
				        <th>年龄</th>
				        <th>家庭住址</th>
				    </tr>
				    <tr>
				        <td><input type="checkbox" name="male" id="" value="box1" /></td>
				        <td>张三1</td>
				        <td>男</td>
				        <td>19</td>
				        <td>福建省龙岩市</td>
				    </tr>
				    <tr>
				        <td><input type="checkbox" name="female" id="" value="box2" /></td>
				        <td>张三2</td>
				        <td>女</td>
				        <td>19</td>
				        <td>福建省龙岩市</td>
				    </tr>
				    <tr>
				        <td><input type="checkbox" name="male" id="" value="box3" /></td>
				        <td>张三3</td>
				        <td>男</td>
				        <td>19</td>
				        <td>福建省龙岩市</td>
				    </tr>
				    <tr>
				        <td><input type="checkbox" name="female" id="" value="box4" /></td>
				        <td>张三4</td>
				        <td>女</td>
				        <td>19</td>
				        <td>福建省龙岩市</td>
				    </tr>
				    <tr>
				        <td><input type="checkbox" name="male" id="" value="box5" /></td>
				        <td>张三5</td>
				        <td>男</td>
				        <td>19</td>
				        <td>福建省龙岩市</td>
				    </tr>
				</table>
				<td><input type="checkbox" name="" id="allin" value="" onclick="alls();"/></td>全选
				<td><input type="checkbox" name="" id="allmale" value="" onclick="allmaless();" /></td>全选男生
				<td><input type="checkbox" name="" id="allfemale" value="" onclick="allfemales();"/></td>全选女生
				<button type="submit" >删除</button>
			</form>
		    
		
	</body>
		<script type="text/javascript">
			function alls()
			{
				var tables =document.getElementById('tableid');
				var inputs =tables.getElementsByTagName('input');
				var checks =document.getElementById('allin');
				
				for(var i=0;i<inputs.length;i++)
				{
					inputs[i].checked = checks.checked;
				}
			}
			function allmaless()
			{
				var tables = document.getElementById('tableid');
				var inputs = tables.getElementsByTagName('input');
				var checks1 =document.getElementById('allmale');
				for(var i=0;i<inputs.length;i++){
					if(inputs[i].name=="male"){
						inputs[i].checked = checks1.checked;
					}
					
				}
			}
			function allfemales()
			{
				var tables =document.getElementById('tableid');
				var inputs =tables.getElementsByTagName('input');
				var checks2 =document.getElementById('allfemale');
				for(var i=0;i<inputs.length;i++)
				{
					if(inputs[i].name=="female")
					{
						inputs[i].checked = checks2.checked;
					}
				}
			}
		</script>
</html>